import api from "../api";
import type Typings from "@/typings";

export default {
  jobListApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/list";
    return api.get(url, data, { ...config });
  },

  jobAddApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/add";
    return api.post(url, data, { ...config, openLoading: true });
  },

  jobUpdateApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/update";
    return api.post(url, data, { ...config, openLoading: true });
  },

  jobCheckApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/check";
    return api.get(url, data, { ...config });
  },

  jobRemoveApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/remove";
    return api.get(url, data, { ...config });
  },

  jobFinishApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/finish";
    return api.post(url, data, { ...config });
  },

  jobSetTopApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/setTop";
    return api.post(url, data, { ...config });
  },

  jobBatchApi: (
    data: Typings.Common.plainObj = {},
    config: Typings.Common.plainObj = {}
  ) => {
    const url = "/job/batch";
    return api.post(url, data, { ...config });
  },
};
